<html>
<head>
	<meta charset='utf-8' />
	<title>小区信息助手</title>
	<meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=0" />
	<style>
		
		@media screen and (max-width:450px){
			#content{width:98%;margin:0 auto;border:0px solid}
			/*页面宽度900以下时 .abc的宽度为450*/
		}
		@media screen and (min-width:450px){
			#content{width:450px;margin:0 auto;border:0px solid}
			/*页面宽度900以下时 .abc的宽度为450*/
		}
	</style>
</head>
<body id='content'>
	<div style='height:100%;padding:5px' id='main' class='l1'>
		
		<h2 style='text-align:center'>发布信息</h2>

		<div style='display:flex;margin:20px 0'>
			<div style='display:inline-block'>标题：</div>
			<div style='flex:1'>
				<input type="text" id='title' style='width:100%'/>
			</div>
		</div>
		<div style='display:flex;margin:20px 0'>
			<div style='display:inline-block'>内容：</div>
			<div style='flex:1'>
				<textarea style='width:100%;height:300px;resize:none' id="info"></textarea>
			</div>
		</div>
		<div style='display:flex;margin:20px 0'>
			<div style='display:inline-block'>类型：</div>
			<label><input type="radio" name='rtype' value='normal'  checked /> 普通</label>
			<label><input type="radio" name='rtype' value='ticket' /> 投票</label>
		</div>

		<div style='margin:20px auto;text-align:center'>
			<button id='submit'>提交</button>
			<a href="area_detail.html"><button>返回</button></a>
		</div>

	</div>



</body>
</html>
<script src='../public/jquery.js'></script>
<script src='../public/fun.js'></script>
<script>
if(!sessionStorage.current_area_id || !sessionStorage.current_area_name){
	history.go(-1);
}
var tokenSet = GetCityInfo();
var user_info = GetUserInfo();
var area_id = sessionStorage.current_area_id;

$(function(){
	$('#submit').click(function(){
		var title = $('#title').val().trim();
		var info = $('#info').val().trim();
		var rtype = $('input[name=rtype]:checked').val().trim();
		if(!title || !info || !rtype){
			return;
		}
		var data = {
			type:'issue_info',
			area_id:area_id,
			title:title,
			info:info,
			rtype:rtype
		}
		AjaxBefore(data,function(res){
			if(!/^{.*}$/.test(res)){
				return;
			}
			var tmp = JSON.parse(res);
			sessionStorage.token1 = tmp.token1
			switch(tmp.stat){
				case 'err1':A('请求异常！');break;
				case 'err2':A('每天发布信息不得超过5条！');break;
				case 'ok':A('发布成功!');history.go(-1);break;
			}
		});
	});

});
</script>